package com.ztgf.shopping.api.client.epg;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.ztgf.common.constant.Result;
import com.ztgf.common.enums.CodeEnum;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.*;
import com.ztgf.shopping.models.service.epg.IEpgShopMainNavigationService;
import com.ztgf.shopping.models.bo.epg.EpgShopMainNavigationBO;
import com.ztgf.shopping.models.dto.epg.EpgShopMainNavigationDTO;

import java.util.List;

/**
 * 店铺页主导航控制器
 *
 * @author YUE
 * @Date 2020-05-28 18:39:38
 */

@RestController
@RequestMapping("/api/epgShopMainNavigation")
@Slf4j
@Api(value = "EpgShopMainNavigationApiController",tags = "店铺页主导航Api接口")
public class EpgShopMainNavigationApiController {

    @DubboReference
    private IEpgShopMainNavigationService epgShopMainNavigationService;

    @PostMapping("/get")
    @ApiOperation(value = "根据id查找",notes = "根据id查找")
    @ApiImplicitParam(name = "id",value = "id",required = true,paramType = "query", dataType = "Long")
    public Result<EpgShopMainNavigationDTO> get(@RequestParam("id") Long id){
        if(id == null){
            return new Result<>(CodeEnum.FAIL_100002 );
        }

        EpgShopMainNavigationDTO dto = epgShopMainNavigationService.selectById(id);

        return new Result<>(dto);
    }

    @ApiOperation(value = "店铺页主导航列表",notes = "店铺页主导航列表")
    @PostMapping("/querySelectList")
    public Result<List<EpgShopMainNavigationDTO>> querySelectList(EpgShopMainNavigationBO bo){
        if(null == bo)
            return new Result<>(CodeEnum.FAIL_100002 );
        List<EpgShopMainNavigationDTO> epgShopMainNavigationDTOList = epgShopMainNavigationService.getBySelectShopMainNavigationInfoNoPage(bo);
        return new Result<>(epgShopMainNavigationDTOList);
    }
}
